@extends('back.index')
@section('title','课程管理')
@section('style')
    <style>
        td{border-right:1px solid #ccc;}
        img{width:192px;height:108px;}
    </style>
@endsection
@section('mian')
    <div style="font-size:14px;padding:20px;" class="modal-content">
        <h2>
            <input type="submit" class="btn btn-info btn-lg" value="添加课程" data-toggle="modal" data-target="#myModal">
            <span class="glyphicon glyphicon-hand-left"></span>
            <!-- Modal -->
            <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                <div class="modal-dialog" role="document" style="z-index:1111;">
                    <div style="font-size:14px;" class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h3 class="modal-title" style="text-align:center;" id="myModalLabel">添加课程</h3>
                        </div>
                        <form  action="{{url('back/center/add_course')}}" method="post" enctype="multipart/form-data">
                            {{csrf_field()}}
                            <div class="modal-body">
                                <div class="email_tx">
                                        <div>
                                            <span>添加头像</span>
                                            <input name="icon_cg" style="position: relative;top:-20px;left:100px;" type="file" >
                                        </div>
                                        <div>
                                            <span>添加图片</span>
                                            <input name="img_cg" style="position: relative;top:-20px;left:100px;" type="file">
                                        </div>
                                    <div>
                                        <h4 style="width:100px;float:left;">昵称:</h4>
                                        <input style="width:460px;" name="nickname_cg" class="form-control" placeholder="填写昵称" type="text">
                                    </div>
                                        <div style="margin-top:30px;">
                                            <h4 style="width:100px;">课程标题:</h4>
                                            <input style="width:460px;position: relative;top:-35px;left:100px;" name="title_cg" class="form-control" id="focusedInput" type="text" value="">
                                        </div>
                                        <div>
                                            <h4 style="width:100px;margin-top:-10px;">课程分类:</h4>
                                            <div class="course_input" style="position: absolute;top: 205px;left: 115px;">
                                                <span style="margin-right:10px;" class="course_span"><input type="radio" value="1" name="list_cg" >武侠</span>
                                                <span style="margin-right:10px;" class="course_span"><input type="radio" value="2" name="list_cg" >玄幻</span>
                                                <span style="margin-right:10px;" class="course_span"><input type="radio" value="3" name="list_cg" >奇幻</span>
                                                <span style="margin-right:10px;" class="course_span"><input type="radio" value="4" name="list_cg" >仙侠</span>
                                                <span style="margin-right:10px;" class="course_span"><input type="radio" value="5" name="list_cg" >都市</span>
                                                <span style="margin-right:10px;" class="course_span"><input type="radio" value="6" name="list_cg" >历史</span>
                                                <span style="margin-right:10px;" class="course_span"><input type="radio" value="7" name="list_cg" >军事</span>
                                                <span style="margin-right:10px;" class="course_span"><input type="radio" value="8" name="list_cg" >灵异</span>
                                            </div>
                                        </div>
                                        <div>
                                            <h4 style="margin-top:20px;">课程内容:</h4>
                                            <textarea style="position: relative;top: -28px; left: 98px;width: 460px;height: 138px;resize: none;overflow: auto;" name="brief" id="passport_userdetail" class="mod-cus-input mod-cus-input-4">

                                            </textarea>
                                        </div>
                                </div>
                            </div>
                            <div>
                                @if(count($errors) > 0)
                                    @foreach($errors->all() as $error)
                                        <p style="color: red;text-align:center;">{{$error}}</p>
                                    @endforeach
                                @endif
                            </div>
                            <div class="modal-footer" style=" border-top:none;text-align:center;">
                                <input style="width:200px;" class="btn btn-info" type="submit" value="确定">
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </h2>
        <div class="my-order-wrap">
            <table class="table table-hover my-order-list" data-token="b85c364572f96a34c7a2e04eeee935e4">
                <thead>
                <tr class="info" style="text-align:center;">
                    <th>ID</th>
                    <th>头像</th>
                    <th style="width:200px;" class="order-icon-h">课程图片</th>
                    <th class="order-num-h">课程标题</th>
                    <th class="order-name-h">分类课程</th>
                    <th class="order-shoop-h">添加时间</th>
                    <th style="width:300px;" class="order-time-h">课程内容</th>
                    <th class="" style="width:50px;">操作</th>
                </tr>
                </thead>
                <tbody>
                {{--一条订单--}}
                @if(empty(count($course)))
                    <tr>
                        <td style="background-color:#A2D8F2;line-height:10;height:100px;text-align:center;font-size:20px;" colspan="8">暂无数据</td>
                    </tr>
                @else
                @foreach($course as $k)
                <tr style="height:100px;" data-trade-id="2017041300214717421" data-trade-status="0" data-bank-pay="0.00">
                    <td>
                        <div class="ie8-td-fixed">
                            {{$k->id}}
                        </div>
                    </td>
                    <td>
                        <img style="width:63px;height:63px;" src="{{asset('/image/course/'.$k->img)}}">
                    </td>
                    <td>
                        <div class="ie8-td-fixed">
                            @if($k->icon)
                                <img src="{{asset('/image/home/'.$k->icon)}}">
                            @else
                                <img src="{{asset('zjx/image/kecheng1.jpg')}}">
                            @endif
                        </div>
                    </td>
                    <td>
                        <div class="ie8-td-fixed">
                            {{$k->title}}
                        </div>
                    </td>
                    <td>
                        <a class="good-title" href="" target="_blank">
                            @if($k->type==1)
                                武侠
                            @elseif($k->type==2)
                                玄幻
                            @elseif($k->type==3)
                                奇幻
                            @elseif($k->type==4)
                                仙侠
                            @elseif($k->type==5)
                                都市
                            @elseif($k->type==6)
                                历史
                            @elseif($k->type==7)
                                军事
                            @elseif($k->type==8)
                                灵异
                            @endif
                        </a>
                    </td>
                    <td>
                        <div class="ie8-td-fixed">
                            {{date("Y-m-d h:i:s",$k->uptime)}}
                        </div>
                    </td>
                    <td class="order-time-b">
                        <div class="ie8-td-fixed">
                            <div style="height:100px;overflow:auto">
                                {{$k->dist}}
                            </div>
                        </div>
                    </td>
                    <td style="text-align:center;">
                        <a href="{{url('back/center/edit_course/'.$k->id)}}">修改</a>
                        <p style="text-align:center;margin-bottom:0;">
                            <span style="width:14px;" class="glyphicon glyphicon-resize-vertical">&nbsp;&nbsp;&nbsp;</span>
                        </p>
                        <a href="{{url('back/center/del_course/'.$k->id)}}">删除</a>
                    </td>
                </tr>
                @endforeach
                @endif
                </tbody>
            </table>
            {{$course->links()}}
        </div>
    </div>
@endsection